chunkygoo.
09/23/2022, 6:27 PMchunkygoo.
09/23/2022, 6:28 PMchunkygoo.
09/23/2022, 6:28 PMrp_st
09/23/2022, 6:30 PMchunkygoo.
09/23/2022, 6:47 PMrp_st
09/23/2022, 6:55 PMchunkygoo.
09/24/2022, 4:18 AMchunkygoo.
09/24/2022, 4:18 AMchunkygoo.
09/24/2022, 4:18 AMimport React from 'react';
import Image from 'next/image';
import { useEffect, useState } from 'react';
import { SignInAndUp } from 'supertokens-auth-react/recipe/emailpassword';
export default function Index() {
const [componentMounted, setComponentMounted] = useState(false);
useEffect(() => {
setComponentMounted(false);
}, []);
return (
<div className="dark:bg-white mx-auto">
<div className="flex justify-center h-screen">
<div className="relative hidden bg-cover lg:block lg:w-[60%] xl:w-2/3">
<Image
src="/computer.jpg"
className="object-center object-cover pointer-events-none"
alt="Computer image"
layout="fill"
priority={true}
/>
<div className="flex items-center h-full px-20 bg-gray-900 bg-opacity-40 relative z-1">
<div>
<h2 className="text-4xl font-bold text-white">Test</h2>
</div>
</div>
</div>
<div className="flex items-center w-full max-w-md px-3 mx-auto lg:w-[40%] xl:w-2/6">
<div className="text-center mx-auto">
<h2 className="text-4xl font-bold text-center text-gray-700">
Test
</h2>
<SignInAndUp />
</div>
</div>
</div>
</div>
);
}
rp_st
09/24/2022, 4:18 AMchunkygoo.
09/24/2022, 4:19 AMchunkygoo.
09/24/2022, 4:21 AMimport React, { useEffect } from 'react';
import dynamic from 'next/dynamic';
import SuperTokens from 'supertokens-auth-react';
import { redirectToAuth } from 'supertokens-auth-react/recipe/emailpassword';
import { useRouter } from 'next/router';
const SuperTokensComponentNoSSR = dynamic(
new Promise((res) => res(SuperTokens.getRoutingComponent)),
{ ssr: false }
);
export default function Auth() {
const router = useRouter();
// if the user visits a page that is not handled by us
// (like /auth/asdjklnogjk), then we redirect them back to the /auth/loginsignup page.
useEffect(() => {
if (SuperTokens.canHandleRoute() === false) {
router.push('/auth/loginsignup');
}
}, []);
return (
<div className="flex h-[75vh]">
<div className="m-auto">
<SuperTokensComponentNoSSR />
</div>
</div>
);
}
chunkygoo.
09/24/2022, 4:21 AMchunkygoo.
09/24/2022, 4:21 AMrp_st
09/24/2022, 4:21 AMSignInAndUp
?chunkygoo.
09/24/2022, 4:21 AMrp_st
09/24/2022, 4:22 AMchunkygoo.
09/24/2022, 4:26 AMchunkygoo.
09/24/2022, 4:26 AMimport React from 'react';
import dynamic from 'next/dynamic';
import Index from '../../components/Auth/Index';
const IndexNoSSR = dynamic(new Promise((res) => res(<Index />)), {
ssr: false,
});
export default function loginsignup() {
return (
<div className="flex h-[75vh]">
<div className="m-auto">
<IndexNoSSR />
</div>
</div>
);
}
chunkygoo.
09/24/2022, 4:26 AMchunkygoo.
09/24/2022, 4:26 AMrp_st
09/24/2022, 4:27 AMconst IndexNoSSR = dynamic(new Promise((res) => res(Index)), {
ssr: false,
});
chunkygoo.
09/24/2022, 4:28 AMchunkygoo.
09/24/2022, 4:28 AMrp_st
09/24/2022, 4:29 AMchunkygoo.
09/24/2022, 4:31 AMchunkygoo.
09/24/2022, 4:31 AMrp_st
09/24/2022, 4:32 AM